package ru.gerunn.silent.trash;

import java.math.BigInteger;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;

import javax.net.ssl.SSLSession;

public class Service {

	public static void printSSLSession(SSLSession session) {

		Certificate[] cchain2 = session.getLocalCertificates();

		for (int i = 0; i < cchain2.length; i++) {
			System.out.println(((X509Certificate) cchain2[i]).getSubjectDN());
		}

		System.out.println("Peer host is " + session.getPeerHost());
		System.out.println("Cipher is " + session.getCipherSuite());
		System.out.println("Protocol is " + session.getProtocol());
		System.out.println("ID is " + new BigInteger(session.getId()));
		System.out.println("Session created in " + session.getCreationTime());
		System.out.println("Session accessed in " + session.getLastAccessedTime());

	}

}
